package com.springsecurity.controller.weibo;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HttpServletBean;

import com.springsecurity.service.impl.weibo.WeiboUserServiceI;
import com.springsecurity.util.StringUtils;

@Controller
@RequestMapping("weiboUserController")
public class WeiboUserController {

	@Autowired
	private WeiboUserServiceI weiboUserService;
	
	@RequestMapping(value="/toRegister")
	public String toRegister(){
		return "register/register";
	}
	
	@RequestMapping(value="/register")
	public void register(HttpServletRequest request,String nickname,String email,String password){
		Long id=0L;
		if(!StringUtils.isEmpty(nickname) && !StringUtils.isEmpty(email) && !StringUtils.isEmpty(password)){
			id=weiboUserService.register(email, nickname, password);
		}
		System.out.println(id);
	}
	
}
